<?php
/* -------------------------------------
*  
*  Brave Look
*  
*  @copyright: Vasilij Petrov
*  @author: Vasilij Petrov
*  
*  this file should be load first
*  
* --------------------------------------
*/

$status = "debug";
switch ($status)
{
	case "release":
		$dbhost = "smelvzor";
		$dbuser = "smelvzor";
		$dbpass = "SRd7TbthdjQlrHM";
		$dbname = "smelvzor";
		error_reporting(0);
		break;
	case "debug":
		if (strpos($_SERVER['SERVER_NAME'],"smelvzor.org") !== false)
			die("<h1>Site is Updating</h1>");
		$dbhost = "localhost";
		$dbuser = "root";
		$dbpass = "1";
		$dbname = "look";
		error_reporting(E_ALL);
		break;
}


define("_INDEX",1);
define("DS",DIRECTORY_SEPARATOR);
define("MAIN_DIR",dirname(__FILE__));
define("SYSTEM",MAIN_DIR.DS."_system");
session_start();
if (!isset($_SESSION['userId'])){
	setcookie("PHPSESSID","",0,"/");
	session_destroy();
}

require_once SYSTEM.DS."defines.php";
require_once SYSTEM.DS."classes.php";
require_once SYSTEM.DS."functions.php";

$route = new Router();
$db = new MySQL($dbhost,$dbuser,$dbpass,$dbname);
$user = new User();

switch($route->getPlace())
{
	// auth & reg
	case "registration": 	require_once REG.DS.MAIN; break;
	case "auth": 			require_once AUTH.DS.MAIN; break;
	
	// ajax
	case "ajax": 			require_once AJAX.DS.MAIN; break;
	
	// admin & coordinator
	case "coordinator":		require_once COORDINATOR.DS.MAIN; break;
	case "admin": 			require_once ADMIN.DS.MAIN; break;
	
	//site
	case "cabinet": 		require_once CABINET.DS.MAIN; break;
	case "user": 			require_once USER.DS.MAIN; break;
	case "main": 			require_once MAINPAGE.DS.MAIN; break;
	case "news": 			require_once NEWS.DS.MAIN; break;
	case "about": 			require_once ABOUT.DS.MAIN; break;
	case "vote": 			require_once VOTE.DS.MAIN; break;
	case "rumors": 			require_once RUMORS.DS.MAIN; break;
	
	
	default: $route->get302();
}

$db->close();

?>